package org.flexthinker.binding.bean.support
{
    import mx.utils.StringUtil;

    /**
     * This exception can be thrown at various points in the life cycle
     * of a <code>PropertyReader</code> / <code>PropertyWriter</code>.
     *
     * Any time an error is captured while writing or reading a property
     * the Error is wrapped into a <code>PropertyResolutionError</code> and is re-thrown.
     */
    public class PropertyResolutionError extends Error
    {
        private var exception:Error;

        public function PropertyResolutionError(err:Error):void
        {
            this.exception = err;
            super(getErrorMessage(), err.errorID);
        }

        private function getErrorMessage():String
        {
            return StringUtil.substitute("PropertyResolutionError. Reason:\n{0}",exception.message);
        }

        /*
        override public function getStackTrace():String
        {
            return exception.getStackTrace();
        }
        */
    }
}